import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useAppStore = defineStore(
  'app',
  () => {
    const isCollapse = ref(false)
    const currentMenuKey = ref('/')
    function toggleCollapse() {
      isCollapse.value = !isCollapse.value
    }

    function setCurrentMenuKey(key: string) {
      currentMenuKey.value = key
    }
    return {
      isCollapse,
      currentMenuKey,
      toggleCollapse,
      setCurrentMenuKey,
    }
  },
  { persist: true },
)
